package com.kws.merchant.controller;


import com.kws.merchant.domain.OperationRepertory;
import com.kws.merchant.domain.po.RepertoryPo;
import com.kws.merchant.service.OperationRepertoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
import com.kws.common.core.domain.R;

import javax.annotation.Resource;
import java.util.List;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * 运维-库存管理(OperationRepertory)表控制层
 *
 * @author yxy
 * @since 2024-10-28 15:39:21
 */
@RestController
@Api(tags = "运维-库存管理(OperationRepertory)")
@RequestMapping("operationRepertory")
public class OperationRepertoryController {
    /**
     * 服务对象
     */
    @Resource
    private OperationRepertoryService operationRepertoryService;
 
    @PostMapping("/page")
    @ApiOperation(value = "分页查询列表")
    public R<Page<OperationRepertory>> pageList(@RequestBody RepertoryPo repertoryPo){
        return R.ok(operationRepertoryService.pageList(repertoryPo));
    }

    @GetMapping("/detailById/{id}")
    @ApiOperation(value = "通过主键查询单条数据")
    public R<OperationRepertory> detailById(@PathVariable Integer id) {
        return R.ok(operationRepertoryService.getById(id));
    }


    @PostMapping("/add")
    @ApiOperation(value = "新增数据")
    public R add(@RequestBody OperationRepertory operationRepertory) {
        return R.ok(operationRepertoryService.save(operationRepertory));
    }

    @PostMapping("/update")
    @ApiOperation(value = "修改数据")
    public R update(@RequestBody OperationRepertory operationRepertory) {
        return R.ok(operationRepertoryService.updateById(operationRepertory));
    }


    @PostMapping("/delete")
    @ApiOperation(value = "删除数据")
    public R delete(@RequestBody List<Integer> idList) {
        return R.ok(operationRepertoryService.removeByIds(idList));
    }
}
